package com.hxm.canvas;

import android.content.Context;

/**
 * Created by hxm on 2017/7/13.
 * 描述：
 */
public class SizeUtil {

    public static int dp2px(Context context, int dpValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dpValue * scale + 0.5f);
    }

    public static int px2do(Context context, int pxValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (pxValue / scale + 0.5f);
    }

}
